<?php

namespace app\common\validate\Hotel;

// 引入Thinkphp底层的验证器
use think\Validate;

/**
 * 定义优惠券验证器
 */
class Coupon extends Validate{
    // 设置我们要验证的字段规则
    protected $rule = [
        'title' => ['require'],
        'thumb' => ['require'],
        'createtime' => ['require'],
        'endtime' => ['require'],
        'rate' => ['require'],
        'total' => ['require'],
        'status' => ['require','in:1,2,3']
    ];

    /**
     * 设置错误的提示信息
     */
    protected $message = [
        'title.require' => '活动标题未知',
        'thumb.require' => '活动缩略图必填',
        'createtime.require' => '活动开始时间必填',
        'endtime.require' => '活动结束时间必填',
        'rate.require' => '折扣率必填',
        'status.require' => '状态必填',
        'total.require' => '数量必填',
        'status.in' => '状态未知'
    ];

    /**
     * 设置验证器的场景
     */
    protected $scene = [
    ];
}

?>
